package com.example.makerspace.service.impl;

import com.example.makerspace.dto.NewsDTO;
import com.example.makerspace.dto.Result;
import com.example.makerspace.manager.DataManager;
import com.example.makerspace.manager.NewsManager;
import com.example.makerspace.service.GuideService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

@Service
public class GuideServiceImpl implements GuideService {
    @Resource
    private NewsManager newsManager;

    @Resource
    private DataManager dataManager;

    public final static Integer LATEST_NEWS_NUM = 3;
    public final static Integer RECOMMEND_NEWS_NUM = 5;


    @Override
    public Result latestNewsList() {
        return newsManager.latestNews(LATEST_NEWS_NUM);
    }

    @Override
    public Result newsDetail(NewsDTO newsDTO) {
        return newsManager.detail(newsDTO);
    }

    @Override
    public Result recommendNews() {
        return newsManager.latestNews(RECOMMEND_NEWS_NUM);
    }

    @Override
    public Result visit() {
        return dataManager.visit();
    }
}
